filemanager.js ➔ filemanager   A
last analyzed

Complexity

Conditions 5

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 9
rs 9.3333
c 0
b 0
f 0
cc 5
1
/**
2
 * Open file manager and return selected files.
3
 * Promise is never resolved if window is closed.
4
 *
5
 * @returns Promise<array> Array of selected files with properties:
6
 *      icon        string
7
 *      is_file     bool
8
 *      is_image    bool
9
 *      name        string
10
 *      thumb_url   string|null
11
 *      time        int
12
 *      url         string
13
 */
14
window.filemanager = function filemanager() {
15
    var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/filemanager';
16
    var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'FileManager';
17
    var features = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'width=900,height=600';
18
    return new Promise(function (resolve) {
19
        window.open(url, target, features);
20
        window.SetUrl = resolve;
21
    });
22
};
23